﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using mealplanner.control;

namespace mealplanner.View
{
    public partial class Details : Form
    {
        public Details()
        {
            InitializeComponent();

        }
        Meal meal = new Meal();
            
        public Details(string mealname) {
            InitializeComponent();
            label9.Text =mealname;
            view_ing(mealname);
            view_cost(mealname);
            view_nutarion(mealname);
            view_desc(mealname);
            view_image(mealname);

        }

        void view_cost(string mealname) {
           double totalcost=meal.OveralMealCost(mealname);
           cost.Text ="Total Cost : "+totalcost.ToString();
            
        }

        void view_nutarion(string mealname) {

           double calorize=meal.CaluclateCalories(mealname);
           nutration.Text ="Calorize : " +calorize.ToString();
        }

            
        void view_ing(string mealname) {
            ArrayList ings = new ArrayList();
            ings = meal.MealIngredient(mealname);

            string ing = "";
            int i = 1;
            foreach (string ingr in ings)
            {
                ing += i + "- " + ingr + "\n";
                i++;
            }

            ingredient.Text = ing;

        }

        

        void view_desc(string mealname) {
           
          string desc=meal.getDescriptionByMealName(mealname);
          description.Text = desc;
        }

        void view_image(string mealname) {

            string path = meal.getImageByMealName(mealname);
            pictureBox1.ImageLocation = path;
        }

        

    }
}
